<template>
    <div id="app">
      <el-form ref="add-machine" :model="machine" label-width="100px">
        <el-form-item label="名称">
          <el-input v-model="machine.name" placeholder="请输入零食名"></el-input>
        </el-form-item>

        <el-form-item label="是否可用">
          <el-radio-group v-model="machine.state">
            <el-radio label="1">可用</el-radio>
            <el-radio label="0">不可用</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="描述">
          <el-input v-model="machine.description"  type="textarea" rows="5"></el-input>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="save()">提交</el-button>
        </el-form-item>
      </el-form>
    </div>
</template>

<script>
    export default {
      data(){
        return {
          machine:{}
        }
      },
      methods:{
        save(){
          //发出ajax请求
          this.axios.post("/machine/add",this.machine).then((resp)=>{
            this.$router.push("/machine/MachineList");
          })
        }
      }
    }
</script>


<style scoped>

</style>
